<template>
  <div class="comment" v-if="comment">
    <div class="user">
      <div class="left">
        <div class="img-box">
          <img :src="comment.a.p" alt="" />
        </div>
        <div class="my-text name">{{ comment.a.n }}</div>
        <div class="lvl">lv{{ comment.a.lvl }}</div>
      </div>
      <div class="right">好评</div>
    </div>
    <div class="comment-text">{{ comment.des }}</div>
    <div class="comment-img" v-if="comment.images.length">
      <div>
        <div
          class="img-item"
          v-for="(img, index) in comment.images"
          :key="index"
        >
          <img :src="img.i" alt="" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["comment"],
  created() {
    console.log(this.comment);
  },
};
</script>

<style lang="scss" scoped>
.comment {
  width: 100%;
  padding: 0.1rem 0;
  .user {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .left {
      display: flex;
      align-items: center;
      .img-box {
        width: 0.3rem;
        height: 0.3rem;
        border-radius: 0.15rem;
        overflow: hidden;
      }
      .name {
        font-size: 0.14rem;
        color: var(--text-black);
        margin-left: 0.08rem;
      }
      .lvl {
        font-size: 0.12rem;
        color: var(--text-lv);
        margin-left: 0.04rem;
      }
    }
    .right {
      text-align: center;
      min-width: 0.5rem;
      color: var(--text-red);
    }
  }
  .comment-text {
    margin: 0.1rem 0;
    font-size: 0.16rem;
  }
  .comment-img {
    width: 100%;
    overflow: scroll;
    &::-webkit-scrollbar {
      display: none;
    }
    > div {
      width: max-content;
      .img-item {
        width: 0.8rem;
        height: 0.8rem;
        border-radius: 0.06rem;
        overflow: hidden;
        margin-right: 0.1rem;
      }
    }
  }
}
</style>